//
//  SureSendView.m
//  OrderFood
//
//  Created by xiaofang wang on 2018/10/25.
//  Copyright © 2018年 zhiyuan. All rights reserved.
//

#import "SureSendView.h"

@implementation SureSendView
-(instancetype)initWithFrame:(CGRect)frame withTitle:(NSString *)titleStr{

    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionOftap)];
        [self addGestureRecognizer:tap];
        [self setUIWithStr:titleStr];
    }
    return self;
}
-(void)actionOftap{
    if([self.delegateS respondsToSelector:@selector(sureSendViewdidRemove)]){
        [self.delegateS sureSendViewdidRemove];
    }
    [self removeFromSuperview];
}
-(void)setUIWithStr:(NSString *)titleStr{
    UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(40, (SCREEN_HEIGHT-174)/2.0, SCREEN_WIDTH-80, 174)];
    bgView.backgroundColor = WHITECOLOR;
    bgView.layer.cornerRadius = 10;
    [self addSubview:bgView];
    
    UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake((bgView.mh_width-65)/2.0, 30, 65, 65)];
    imgView.image = IMAGE(@"ok");
    [bgView addSubview:imgView];
    
    UILabel *titleLb = [[UILabel alloc] initWithFrame:CGRectMake(0, imgView.mh_bottom+20, bgView.mh_width, 30)];
    titleLb.font = BFONT(16);
    titleLb.text = titleStr;
    titleLb.textAlignment = NSTextAlignmentCenter;
    [bgView addSubview:titleLb];
    
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
